<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">

    <h:form id="tp">
        <rich:panel header="合同列表" styleClass="content-hight">
            <a4j:commandButton value="刷新" action="#{contractCheckBean.queryList}"
                               execute="@this" render="tableGroup"/>
            <h:panelGroup id="tableGroup">
                <rich:dataScroller for="tableEdit" execute="@this" render="tableGroup"/>
                <div style="width:750px;overflow: auto;">
                    <rich:dataTable id="tableEdit"
                                    value="#{contractCheckBean.dataList}" var="incontract"
                                    rowClasses="list-row-odd,list-row-even"
                                    headerClass="table-header"
                                    rows="10" rowKeyVar="rowKey"
                                    style="width:1200px;margin-bottom:5px;"
                                    noDataLabel="无数据">

                        <rich:column sortBy="#{incontract.number}">
                            <h:commandLink action="#{contractCheckBean.rowSelected(rowKey)}" >
                                <h:outputText value="审批" rendered="#{incontract.billStatusForChecker eq '0'}"/>
                                <h:outputText value="查看" rendered="#{not(incontract.billStatusForChecker eq '0')}"/>
                            </h:commandLink>
                        </rich:column>
                        
                        <rich:column>
                            <f:facet name="header">状态</f:facet>
                            <h:outputText value="审批中" rendered="#{incontract.flowMark ge '1'
                                                                  and incontract.flowMark lt '99'}" style="color:blue;"/>
                            <h:outputText value="已通过" rendered="#{incontract.flowMark eq '99'}" style="color:green;"/>
                            <h:outputText value="已退回" rendered="#{incontract.flowMark eq '-1'}" style="color:red;"/>
                        </rich:column>

                        <rich:column sortBy="#{incontract.number}">
                            <f:facet name="header">编号</f:facet>
                                #{incontract.number}
                        </rich:column>

                        <rich:column sortBy="#{incontract.cname}">
                            <f:facet name="header">名称</f:facet>
                            <h:outputText value="#{incontract.cname}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.contractTypeName}">
                            <f:facet name="header">合同类别</f:facet>
                            <h:outputText value="#{incontract.contractTypeName}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.address}">
                            <f:facet name="header">地点</f:facet>
                            <h:outputText value="#{incontract.address}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.orderdate}">
                            <f:facet name="header">签订日期</f:facet>
                            <h:outputText value="#{incontract.orderdate}">
                                <f:convertDateTime dateStyle="medium"/>
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{incontract.start}">
                            <f:facet name="header">开始日期</f:facet>
                            <h:outputText value="#{incontract.start}">
                                <f:convertDateTime dateStyle="medium"/>
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{incontract.deadline}">
                            <f:facet name="header">截止日期</f:facet>
                            <h:outputText value="#{incontract.deadline}">
                                <f:convertDateTime dateStyle="medium"/>
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{incontract.warranty}">
                            <f:facet name="header">质保日期</f:facet>
                            <h:outputText value="#{incontract.warranty}">
                                <f:convertDateTime dateStyle="medium"/>
                            </h:outputText>
                        </rich:column>
                        <rich:column sortBy="#{incontract.nameA}">
                            <f:facet name="header">甲方</f:facet>
                            <h:outputText value="#{incontract.nameA}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.nameAstand}">
                            <f:facet name="header">甲方法人</f:facet>
                            <h:outputText value="#{incontract.nameAstand}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.partner.name}">
                            <f:facet name="header">乙方</f:facet>
                            <h:outputText value="#{incontract.partner.name}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.partner.legalPerson}">
                            <f:facet name="header">乙方法人</f:facet>
                            <h:outputText value="#{incontract.partner.legalPerson}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.target}">
                            <f:facet name="header">标的</f:facet>
                            <h:outputText value="#{incontract.target}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.quality_margin}">
                            <f:facet name="header">质保金</f:facet>
                            <h:outputText value="#{incontract.quality_margin}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.penalty}">
                            <f:facet name="header">违约金</f:facet>
                            <h:outputText value="#{incontract.penalty}"/>
                        </rich:column>
                        <rich:column sortBy="#{incontract.other}">
                            <f:facet name="header">其他</f:facet>
                            <h:outputText value="#{incontract.other}"/>
                        </rich:column>
                        <f:facet name="footer"></f:facet>
                    </rich:dataTable>

                    <rich:jQuery selector="#tableEdit tr:odd" query="addClass('odd-row')" />
                    <rich:jQuery selector="#tableEdit tr:even" query="addClass('even-row')" />
                    <rich:jQuery selector="#tableEdit tr"
                                 query="mouseover(function(){jQuery(this).addClass('active-row')})"/>
                    <rich:jQuery selector="#tableEdit tr"
                                 query="mouseout(function(){jQuery(this).removeClass('active-row')})"/>
                </div>
            </h:panelGroup>
        </rich:panel>
    </h:form>
</ui:composition>
